package com.ljye.jg.ljye.activity;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.Toast;

import com.ljye.jg.ljye.R;

//实名认证
public class Activity_Certification extends Activity {
    public View.OnClickListener listener = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            switch (view.getId()) {
                case R.id.ba_ck://返回
                    finish();
                    break;
                case R.id.submit://提交认证
                    Toast.makeText(Activity_Certification.this, "提交认证", Toast.LENGTH_SHORT).show();
                    break;

                default:
                    break;
            }
        }
    };
    private ImageView back;//返回
    private Button submit;//提交认证

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity__certification);
        //初始化控件
        initView();

        back.setOnClickListener(listener);
        submit.setOnClickListener(listener);
        //能否提交
        submit.setEnabled(false);

    }

    private void initView() {
        back = (ImageView) findViewById(R.id.ba_ck);
        submit = (Button) findViewById(R.id.submit);
    }

    //收起软键盘
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        InputMethodManager manager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        if (event.getAction() == MotionEvent.ACTION_DOWN) {
            if (getCurrentFocus() != null && getCurrentFocus().getWindowToken() != null) {
                manager.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS);
            }
        }
        return super.onTouchEvent(event);
    }
}
